/*
 * Copyright (C) 2012 Jakub Narloch (jmnarloch@gmail.com), All Rights Reserved.
 */

package org.soa.security.service.impl;

import org.soa.security.dao.ServiceConfigurationDAO;
import org.soa.security.model.dto.ServiceConfigurationDTO;
import org.soa.security.service.ServiceConfigurationService;
import org.soa.security.service.SoaServiceException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.ArrayList;
import java.util.List;

/**
 *
 */
@Service
@Transactional
public class ServiceConfigurationServiceImpl implements ServiceConfigurationService {

    /**
     * <p>Instance of {@link ServiceConfigurationDAO} used for persisting service configuration.</p>
     *
     * <p>Null by default.</p>
     *
     * <p>Autowired by IOC container.</p>
     */
    @Autowired
    private ServiceConfigurationDAO serviceConfigurationDAO;

    /**
     * <p>Creates new instance of {@link ServiceConfigurationServiceImpl}</p>
     */
    public ServiceConfigurationServiceImpl() {
        // empty constructor
    }

    /**
     * {@inheritDoc}
     */
    @Override
    @Transactional(readOnly = true)
    public List<ServiceConfigurationDTO> getByUserId(long userId) throws SoaServiceException {

        ArrayList<ServiceConfigurationDTO> result = new ArrayList<>();

        ServiceConfigurationDTO config = new ServiceConfigurationDTO();
        config.setName("Web Service");
        result.add(config);

        config = new ServiceConfigurationDTO();
        config.setName("Rest");
        result.add(config);

        return result;
    }
}
